package day01;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.junit.Test;

public class ActivitiDemo_01 {
    @Test
    public void testInit(){
        //获取流程引擎对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        System.out.println(processEngine);
    }

    @Test
    public void testDeploy(){
        //获取流程引擎对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //获取仓库 Service
        RepositoryService repositoryService = processEngine.getRepositoryService();
        //调用 RepositoryService 中的 API
        Deployment deploy = repositoryService.createDeployment() //创建部署对象
                .addClasspathResource("bpmn/leaveProcess.bpmn20.xml")
                .addClasspathResource("bpmn/leaveProcess.png")
                .deploy();//进行部署

        System.out.println("部署id"+deploy.getId());
        System.out.println("部署时间"+deploy.getDeploymentTime());
        System.out.println("1");
    }
}
